<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Set Budget</title>
    <link rel="icon" type="image/png" href="{{ url_for('static', filename='phillfinance.png') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
    <nav>
        <ul>
            <li><a href="{{ url_for('home') }}">Home</a></li>
            {% if current_user.is_authenticated %}
                <li><a href="{{ url_for('dashboard') }}">Dashboard</a></li>
                <li><a href="{{ url_for('logout') }}">Logout</a></li>
            {% else %}
                <li><a href="{{ url_for('login') }}">Login</a></li>
                <li><a href="{{ url_for('register') }}">Register</a></li>
            {% endif %}
        </ul>
    </nav>

    <div class="container">
        <h1>Set Your Monthly Budget</h1>

        <!-- Display any flash messages -->
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                <ul class="flashes">
                    {% for category, message in messages %}
                        <li class="flash {{ category }}">{{ message }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
        {% endwith %}

        <!-- Budget form -->
        <form method="POST" action="{{ url_for('set_budget') }}">
            {{ form.hidden_tag() }}
            
            <div class="form-group">
                <label for="budget">Enter Your Monthly Budget:</label>
                {{ form.budget(class="form-control", placeholder="Enter budget amount") }}
            </div>

            <div class="form-group">
                <button type="submit" class="btn btn-primary">Set Budget</button>
            </div>
        </form>

        <p><a href="{{ url_for('dashboard') }}" class="button">Back to Dashboard</a></p>
    </div>

    <!-- Optional Footer -->
    <footer>
        <p>&copy; 2024 PhillFinance Assistant. All rights reserved.</p>
    </footer>

</body>
</html>
